<?php /** @noinspection PhpMethodParametersCountMismatchInspection */

use Dingo\Api\Routing\Router;

$api = app(Router::class);

$api->version('v1',['middleware' => 'api.throttle', 'limit' => 60, 'expires' => 1], function ($api) {
//    路由组
    $api->group(['prefix' => 'auth'],function ($api){
//        注册
        $api->post('register',[\App\Http\Controllers\Auth\RegisterController::class,'register']);
//        登录
        $api->post('login', [\App\Http\Controllers\Auth\LoginController::class,'login']);

//    需要登陆的路由
        $api->group(['middleware' => 'api.auth'],function ($api){
//            退出
            $api->post('logout', [\App\Http\Controllers\Auth\LoginController::class,'logout']);
//            刷新token
            $api->post('refresh', [\App\Http\Controllers\Auth\LoginController::class,'refresh']);
//            修改密码
            $api->post('password/update', [\App\Http\Controllers\Auth\PasswordController::class,'updatePassword']);
//            发送邮件验证码
            $api->post('email/code',[\App\Http\Controllers\Auth\BindController::class,'emailCode']);
//            更新邮箱
            $api->put('email/update',[\App\Http\Controllers\Auth\BindController::class,'updateEmail']);
//            发送手机验证码
            $api->post('phone/code',[\App\Http\Controllers\Auth\BindController::class,'phoneCode']);
//            更新手机号
            $api->put('phone/update',[\App\Http\Controllers\Auth\BindController::class,'updatePhone']);
        });
    });

});
